#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>

#include "vfslib.h"
#include "vfsio.h"

uint32_t key[] = {0x234590ba, 0xfc279847, 0x56237882, 0x12238a91};

VFS_PARAMS params[] = {VFS_PARAM_TEAKEY, key, sizeof(key)};
size_t params_count = sizeof(params) / sizeof(VFS_PARAMS);

int main(int argc, char * argv[])
{
	char buff[102400];
	long int size;
	vfs_init("./", "./");
	vfs_addfs("test.vfs", params, params_count);
	VFILE * f = vfs_fopen("test.txt", "rb");
	if (f)
	{
		vfs_fseek(f, 0, SEEK_END);
		size = vfs_ftell(f);
		FILE * fo = fopen("test_out.txt", "wb");
		if (fo)
		{
			vfs_fseek(f, 0, SEEK_SET);
			size = vfs_fread(buff, 1, 102400, f);
			fwrite(buff, 1, size, fo);
			fclose(fo);
		}
		vfs_fclose(f);
	}
	return EXIT_SUCCESS;
}
